package com.sfzlot.dev.netty.bean.data.powerswitch;

import java.util.Date;

import com.sfzlot.dev.netty.bean.inf.Data;
import com.sfzlot.dev.netty.utils.ByteUtil;

/**
 * 设备通电请求体
 * Created by pierr on 2017/5/30.
 */
public class PowerSwitchStopInData implements Data {
    
    private Date dataCollectTime;	// 数据采集时间
    private int times;				// 多少秒后通电

    public Date getDataCollectTime() {
        return dataCollectTime;
    }

    public void setDataCollectTime(Date dataCollectTime) {
        this.dataCollectTime = dataCollectTime;
    }

	public int getTimes() {
		return times;
	}

	public void setTimes(int times) {
		this.times = times;
	}

	@Override
	public String toString() {
		return "DeviceStopInData [dataCollectTime=" + dataCollectTime + ", times=" + times + "]";
	}

	@Override
	public byte[] toBytes(){
		byte[] dateBytes = ByteUtil.timeToBytes(dataCollectTime);
		byte[] timesBytes = ByteUtil.int2bytes(times);
		return ByteUtil.addAll(dateBytes, timesBytes);
	}

	@Override
	public String transData() {
		return "DeviceStopInData(断电指令请求体) [请求时间=" + dataCollectTime + ", 多久后通电=" + times + "秒]";
	}
}
